<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>白起社区</title>
    <head th:insert="import :: head"></head>
    <!--    <link rel="stylesheet" href="css/bootstrap.min.css">-->
    <!--    <link rel="stylesheet" href="css/bootstrap-theme.min.css">-->
    <!--    <link rel="stylesheet" href="css/community.css">-->
    <!--    <script src="js/jquery-3.6.4.min.js"></script>-->
    <!--    <script src="js/bootstrap.min.js"></script>-->
    <script type="application/javascript">
        //用来判断是否需要关闭页面
        window.onload = function () {
            var closable = window.localStorage.getItem("closable");
            if (closable === "true") {
                window.close();
                window.localStorage.removeItem("closable");
            }
        }
    </script>
</head>
<body>
<!--导航栏-->
<div th:insert="navigation :: nav"></div>
<div class="container-fluid main panel panel-info">
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
            <h3><span class="glyphicon glyphicon-list" aria-hidden="true"></span> 发现</h3>
            <hr>
            <!--热门导航-->
            <ul class="nav nav-tabs">
                <li role="presentation" th:class="${sort == 'new' || sort == null ? 'active':''}">
                    <a th:href="@{/(sort='new')}">最新</a>
                </li>
                <li role="presentation" th:class="${sort == 'hot30' ? 'active':''}">
                    <a th:href="@{/(sort='hot30')}">30天最热</a>
                </li>
                <li role="presentation" th:class="${sort == 'hot7' ? 'active':''}">
                    <a th:href="@{/(sort='hot7')}">7天最热</a>
                </li>
                <li role="presentation" th:class="${sort == 'hot' ? 'active':''}">
                    <a th:href="@{/(sort='hot')}">最热</a>
                </li>
                <li role="presentation" th:class="${sort == 'good' ? 'active':''}">
                    <a th:href="@{/(sort='good')}" class="red">精华帖</a>
                </li>
                <li role="presentation" th:class="${sort == 'no' ? 'active':''}">
                    <a th:href="@{/(sort='no')}">消灭零回复</a>
                </li>
            </ul>
            <div class="media" th:each="question : ${topQuestions}" style="overflow: visible">
                <div class="media-left media-middle avatar">
                    <a href="#">
                        <img class="media-object img-rounded"
                             th:src="${question.user.avatarUrl}"
                             th:alt="${question.user.name}">
                    </a>
                </div >
                <div class="media-body">
                    <h4 class="media-heading">
                        <span th:if="${question.status==2||question.status==3}" class="label label-warning pull-right">置顶</span>
                        <span th:if="${question.status==1||question.status==3}" class="label label-danger pull-right">精华</span>
                        <a th:href="@{'/question/'+ ${question.id}}" th:text="${question.title}"></a>
                    </h4>
                    <span th:text="${question.description}">其实我也不知道，在线找想法</span>
                    <span class="text-desc pull-right">
                        <span th:text="${question.commentCount}"></span> 个回复 •
                        <span th:text="${question.viewCount}"></span> 次浏览 •
                        <span th:text="${#dates.format(question.gmtLatestComment,'yyyy-MM-dd HH:mm')}"></span>
                    </span>
                </div>
            </div>
            <!--问题主题-->
            <div class="media" th:each="question : ${pagination.list}" th:if="${pagination!=null}"  style="overflow: visible">
                <div th:if="${question.status==0||question.status==1}">
                    <div class="media-left media-middle avatar">
                        <a href="#">
                            <img class="media-object img-rounded"
                                 th:src="${question.user.avatarUrl}" alt="...">
                        </a>
                    </div>
                    <div class="media-body">
                        <h4 class="media-heading">
                            <span th:if="${question.status==2||question.status==3}" class="label label-warning">置顶</span>
                            <span th:if="${question.status==1||question.status==3}" class="label label-danger">精华</span>
                            <a th:href="@{'/question/'+${question.id}}" th:text="${question.title}"></a>
                        </h4>
                        <span th:text="${question.description}">其实我也不知道，在线找想法</span>
                        <span class="text-desc pull-right">
                            <span th:text="${question.commentCount==null?0:question.commentCount}"></span> 个评论 •
                            <span th:text="${question.viewCount==null?0:question.viewCount}"></span>次浏览 •
                            <span th:text="${#dates.format(question.gmtModified,'yyyy-MM-dd HH:mm')}"></span>
                        </span>
                    </div>
                </div>
            </div>
            <!--页码-->
            <nav aria-label="Page navigation" th:if="${pagination.size!=0}">
                <ul class="pagination">
                    <li th:if="${!pagination.isFirstPage}">
                        <a th:href="@{/(page=${1},search=${search},tag=${tag},sort=${sort})}" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <li th:if="${pagination.hasPreviousPage}">
                        <a th:href="@{/(page=${pagination.pageNum - 1},search=${search},tag=${tag},sort=${sort})}"
                           aria-label="Previous">
                            <span aria-hidden="true">&lt;</span>
                        </a>
                    </li>
                    <li th:each="page : ${pagination.navigatepageNums}"
                        th:class="${pagination.pageNum == page}?'active':''">
                        <a th:href="@{/(page=${page},search=${search},tag=${tag},sort=${sort})}" th:text="${page}"></a>
                    </li>
                    <li th:if="${pagination.hasNextPage}">
                        <a th:href="@{/(page=${pagination.pageNum + 1},search=${search},tag=${tag},sort=${sort})}" aria-label="Next">
                            <span aria-hidden="true">&gt;</span>
                        </a>
                    </li>
                    <li th:if="${!pagination. isLastPage}">
                        <a th:href="@{/(page=${pagination.pages},search=${search},tag=${tag},sort=${sort})}" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
        <!--热门问题-->
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12 panel panel-info">
            <h4>热门问题</h4>
            <ul class="question-related">
                <li th:each="tag : ${tags}">
                    <span class="glyphicon glyphicon-fire">
                     <a th:href="@{/(page=1,search=${search},tag=${tag},sort=${sort})}" th:text="${tag}"></a>
                    </span>
                </li>
            </ul>
            <hr class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <h4 class="photo-name">图片</h4>
                <img class="photo img-thumbnail" src="/img/life.png">
            </div>
        </div>

    </div>
</div>
<div th:insert="footer :: foot"></div>
</body>
</html>